home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TSPA2560.ARJ / TSUNTE.INT < prev    next >
Text File  |  1991-10-27  |  6KB  |  154 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT E
  5. All rights reserved 19-Aug-89,
  6. Updated 25-Sep-89, 8-Oct-89, 4-Nov-89, 6-Dec-89, 24-Feb-90, 22-Jul-90,
  7.         1-Aug-90
  8.  
  9. Cursor routines, keyboard status, configuration information, file information,
  10. calendar routines.
  11. TSUNTE first appeared in release TSPAS13 of my Turbo Pascal units package.
  12.  
  13. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  14. NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
  15. ANY other usage, such as use in a business enterprise or a university,
  16. contact the author for the terms of registration.
  17.  
  18. The units are under development. Comments and contacts are solicited. If
  19. you have any questions, please do not hesitate to use electronic mail for
  20. communication.
  21. InterNet address: ts@chyde.uwasa.fi         (preferred)
  22. Funet address:    GADO::SALMI
  23. Bitnet address:   SALMI@FINFUN
  24.  
  25. The author shall not be liable to the user for any direct, indirect or
  26. consequential loss arising from the use of, or inability to use, any unit,
  27. program or file howsoever caused. No warranty is given that the units and
  28. programs will work under all circumstances.
  29.  
  30. Timo Salmi
  31. Professor of Accounting and Business Finance
  32. School of Business Studies, University of Vaasa
  33. P.O. BOX 297, SF-65101 Vaasa, Finland
  34. *)
  35.  
  36. unit TSUNTE;
  37.  
  38. (* ======================================================================= *)
  39.                           interface
  40. (* ======================================================================= *)
  41.  
  42. uses Dos;
  43.  
  44. (* =======================================================================
  45.                          Screen related
  46.    ======================================================================= *)
  47.  
  48. (* Turns cursor off, and (since the update tspas13) retains the original
  49.    cursor size behind the scenes *)
  50. procedure CURSOFF;
  51.  
  52. (* Restores the cursor as it was before cursoff (unless, of course, you
  53.    have manipulated cursor size yourself in between) *)
  54. procedure CURSON;
  55.  
  56. (* Turns cursor on using user defined cursor size, the ordinary
  57.    color monitor CGA and EGA values are 6 and 7; VGA: 13,14 *)
  58. procedure CURSOR (LowerScanLine, UpperScanLine : byte);
  59.  
  60. (* Turns on a colored border, CGA and VGA, not EGA *)
  61. procedure BORDER (color : byte);
  62.  
  63. (* Is the monitor a monochrome monitor, if false, then color monitor *)
  64. function MONOFN : boolean;
  65.  
  66. (* =======================================================================
  67.                       Keyboard related
  68.    ======================================================================= *)
  69.  
  70. (* Clear the keyboard typeahead buffer *)
  71. procedure CLB;
  72.  
  73. (* Is CapsLock on *)
  74. function CAPSONFN : boolean;
  75.  
  76. (* Is NumLock on *)
  77. function NUMLONFN : boolean;
  78.  
  79. (* Is ScrollLock on *)
  80. function SCRLONFN : boolean;
  81.  
  82. (* Set CapsLock. Use true to turn on, false to turn off *)
  83. procedure CAPS (TurnOn : boolean);
  84.  
  85. (* Set NumLock. Use true to turn on, false to turn off *)
  86. procedure NUMLOCK (TurnOn : boolean);
  87.  
  88. (* Set ScrollLock. Use true to turn on, false to turn off *)
  89. procedure SCRLOCK (TurnOn : boolean);
  90.  
  91. (* =======================================================================
  92.                       File related
  93.    ======================================================================= *)
  94.  
  95. (* Does a file exist. Detects also read-only and/or hidden files.
  96.    If the name is a directory, false is returned, since directory
  97.    is not considered a file.
  98.    IMPORTANT: Never apply on an open file! *)
  99. function FEXISTFN (fnimi : string) : boolean;
  100.  
  101. (* The size of any file in bytes. In case of an error, returns -1
  102.    IMPORTANT: Never apply on an open file! *)
  103. function FSIZEFN (filename : string) : longint;
  104.  
  105. (* An alternative method for finding the file size. Can handle also
  106.    hidden files. Returns -1 if the file is not found or if FileName
  107.    is a directory or the volumeID *)
  108. function FSIZE2FN (FileName : string) : longint;
  109.  
  110. (* Space to files is allocated in whole clusters rather than by byte.
  111.    This function gives the cluster size of a device.
  112.    In case of an error, the function returns -1. *)
  113. function CLUSIZFN (device : char) : longint;
  114.  
  115. {$IFNDEF VER40}  (* Not Turbo Pascal 4.0 *)
  116. (* The size of a file in total allocated bytes.
  117.    In case of an error, returns -1
  118.    IMPORTANT: Never apply on an open file! *)
  119. function ALLSIZFN (filename : string) : longint;
  120. {$ENDIF}
  121.  
  122. (* Returns the entire command line, first appearance in tspas14.arc
  123.    IMPORTANT: Must be applied before any file access *)
  124. function CMDLNFN : string;
  125.  
  126. (* =======================================================================
  127.                        Date related
  128.    ======================================================================= *)
  129.  
  130. (* Modern weekday based on Zeller's congruence, valid after 14-Sep-1752,
  131.    Sun = 0, Mon = 1 ,..., Sat = 6 *)
  132. function WKDAYFN (day, month, year : word) : byte;
  133.  
  134. (* The number of days in a given month and year, that is the last day
  135.    of a month. Based on Zeller's congruence, valid after 14-Sep-1752 *)
  136. function LASTDMFN (month, year : word) : integer;
  137.  
  138. (* Is a given date a valid date.
  139.    Based on Zeller's congruence, valid from 1-Jan-1753 *)
  140. function DATEOKFN (day, month, year : word) : boolean;
  141.  
  142. (* This function returns the weeknumber of a given date.
  143.    If you consider that it starts on Sunday, set sunday_is_first true.
  144.    If you consider that the week starts on Monday, set sunday_is_first false.
  145.    Valid after 14-Sep-1752.
  146.    This function was programmed by Seppo Pynnönen, Ph.D.,
  147.    University of Vaasa, Finland, sjp@chyde.uwasa.fi *)
  148. function WEEKNRFN (day, month, year : word;
  149.                    sunday_is_first : boolean) : integer;
  150.  
  151. (* Zeller function, valid after 14-Sep-1752 *)
  152. function ZELLERFN (day, month, year : word) : real;
  153.  
  154.